/*
*   串口通信封装
*/
#ifndef __SERIAL_COMMON_H__
#define __SERIAL_COMMON_H__

#include "commonDefine.h"
#include "netTool.h"

//串口默认配置
#define BUAD_RATE   115200
#define FLOW_CTRL   0
#define DATA_BITS   8
#define STOP_BITS   1
#define PARITY      'N'

class serialTool{
public:
    serialTool(cmdWorker* parser);
    virtual ~serialTool();

    int serialToolInit(std::string& devName,
                        int speed = BUAD_RATE,int flow_ctrl = FLOW_CTRL,int databits = DATA_BITS,int stopbits = STOP_BITS,int parity = PARITY);

    int serialSend(const char* data,int length);

    int serialClose();
private:
    int serialFD;
    cmdWorker* worker;
};




#endif